<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Agricola</title>
    <link rel="stylesheet" href="sweetalert2.min.css">
    <script src="sweetalert2@11.js"></script>
    <link rel="stylesheet" href="game.css">
    <script src="core/utils.js"></script>
    <script src="core/event.js"></script>
    <script src="core/finalScore.js"></script>
    <script src="core/resource.js"></script>
    <script src="core/round.js"></script>
    <script src="core/action/buildRooms.js"></script>
    <script src="core/actions.js"></script>
    <script src="core/developmentCard.js"></script>
    <script src="core/cardBase.js"></script>
    <script src="core/minorDevelopmentCard.js"></script>
    <script src="core/animal.js"></script>
    <script type="module" src="core/moduleIndex.js"></script>
    <script src="core/main.js"></script>
    <script src="jquery.min.js"></script>
</head>

<body>
    <div class="resource-bar">
    </div>
    <div class="work-space">
        <div class="common-work-space-container">
            <div class="work-space-column work-space-left-list">
                <div class="work-space-item work-space-border" id="build-rooms" onclick="selectBuildRooms()">
                    <div class="work-space-title">
                        农场扩建
                    </div>
                    <p>
                        5木/泥/石+2芦<br />
                        =1木屋/砖屋/石屋<br />
                        和/或 建造畜棚<br />
                        2木=1畜棚
                    </p>
                </div>
                <div class="work-space-item work-space-border">
                    <div class="work-space-title">
                        广场
                    </div>
                    <p>
                        🐓 和/或 1次发卡
                    </p>
                </div>
                <div class="work-space-item work-space-border" id="grain-seed" onclick="selectResourceByKey('grain-seed')">
                    <div class="work-space-title">
                        谷物种子
                    </div>
                    <p>+1小麦</p>
                </div>
                <div class="work-space-item work-space-border" id="plowing-fields" onclick="selectPlowingFields()">
                    <div class="work-space-title">
                        犁田
                    </div>
                    <p>犁1块田</p>
                </div>
                <div class="work-space-item work-space-border" id="day-laborer" onclick="selectResourceByKey('day-laborer')">
                    <div class="work-space-title">
                        临时工
                    </div>
                    <p>+2食物</p>
                </div>
                <div class="work-space-item work-space-border p4">
                    <div class="work-space-title">
                        资源市场
                    </div>
                    <p>
                        +1芦+1石+1食物
                    </p>
                </div>
                <div class="work-space-item work-space-border p4" style="height: 70px;" id="occupation-training-2" onclick="selectOccupationTraining(2)">
                    <div class="work-space-title">
                        职业训练
                    </div>
                    <p>
                        2食物->1职业卡，前两张职业卡仅需支付1食物
                    </p>
                </div>
                <div class="work-space-item work-space-border p4" id="traveling-players">
                    <div class="work-space-title">
                        卖艺
                    </div>
                    <p>+1食物>>></p>
                </div>
            </div>
            <div class="work-space-column work-space-right-list">
                <div class="work-space-item work-space-border"  style="height: 112.5px;" id="occupation-training-1" onclick="selectOccupationTraining(1)">
                    <div class="work-space-title">
                        职业训练
                    </div>
                    <p>
                        1食物->1职业卡<br />
                        第一张职业卡<br />免费
                    </p>
                </div>
                <div class="work-space-item work-space-border" id="forest" onclick="selectResourceByKey('forest')">
                    <div class="work-space-title">
                        森林
                    </div>
                    <p>+3木>>></p>
                </div>
                <div class="work-space-item work-space-border" id="clay-pit" onclick="selectResourceByKey('clay-pit')">
                    <div class="work-space-title">
                        黏土坑
                    </div>
                    <p>+1泥>>></p>
                </div>
                <div class="work-space-item work-space-border" id="reed-bank" onclick="selectResourceByKey('reed-bank')">
                    <div class="work-space-title">
                        芦苇池
                    </div>
                    <p>+1芦>>></p>
                </div>
                <div class="work-space-item work-space-border" id="fishing" onclick="selectResourceByKey('fishing')">
                    <div class="work-space-title">
                        钓鱼
                    </div>
                    <p>+1食物>>></p>
                </div>
                <div class="work-space-item work-space-border p4" id="coppice">
                    <div class="work-space-title">
                        林地
                    </div>
                    <p>+1木>>></p>
                </div>
                <div class="work-space-item work-space-border p4" id="grove" style="height: 70px;">
                    <div class="work-space-title">树林</div>
                    <p>+2木>>></p>
                </div>
                <div class="work-space-item work-space-border p4" id="clay-pit2">
                    <div class="work-space-title">
                        泥坑
                    </div>
                    <p>+2泥>>></p>
                </div>
            </div>
        </div>
        <div id="turn-cards">
            <!-- <div class="turn-work-space work-space-border" id="development-card" onclick="selectDevelopmentCard()">
                <div class="turn-work-space-with-2-column">
                    <div class="turn-work-space-left">
                        <div class="work-space-title">
                            第${turnNum}轮 发展卡
                        </div>
                        <p>
                            打出1主要 或 次要发展卡
                        </p>
                    </div>
                    <div class="turn-work-space-right">
                        
                    </div>
                </div>
            </div> -->
        </div>
        <div class="future-rewards-container">
            <h3>未来轮次牌上放置的奖励</h3>
            <div class="future-rewards"></div>
        </div>
        <div class="end-turn" onclick="endTurn()">回合结束</div>
    </div>
    <div class="prompt-view work-space-border build-rooms-prompt-view">
        <div>
            农场扩建
        </div>
        <p></p>
        <div class="large-action-button build-stables" onclick="switchToBuildingStables()">建造畜棚</div>
        <div class="large-action-button build-rooms" onclick="switchToBuildingRooms()">建造房屋</div>
        <div class="large-action-button" onclick="endBuildRooms()">扩建结束</div>
    </div>
    <div class="prompt-view work-space-border plowing-fields-prompt-view">
        <div>
            犁田
        </div>
        <p>点击农场中的格子来犁1块田</p>
        <div class="large-action-button" onclick="endPlowingFields()">犁田结束</div>
    </div>
    <div class="prompt-view work-space-border building-Fences-prompt-view">
        <div>
            围栏
        </div>
        <p>
            点击农场中的格子来建造围栏<br />
            同一块牧场的多个格子需要保持邻接
        </p>
        <p id="building-Fences-additional-prompt">
            当前已使用0根栅栏
        </p>
        <div class="large-action-button" id="startAnotherPastureBtn" onclick="startAnotherPasture()">开始围下一个牧场</div>
        <div class="undo-action" id="startAnotherPastureBtn" onclick="undoAddPasture()">撤回上一步</div>
        <div class="large-action-button" onclick="endBuildingFences()">围栏结束</div>
    </div>
    <div class="prompt-view work-space-border move-animal-prompt-view">
        <div>
            移动动物
        </div>
        <p>
            点击农场中的格子来选择动物，然后点击目标格子进行移动。
        </p>
        <div class="large-action-button" onclick="endMoveAnimal()">取消移动</div>
    </div>
    <div class="prompt-view work-space-border remove-animal-prompt-view">
        <div>
            删除动物
        </div>
        <p>
            点击农场中的格子来选择一只动物进行删除。
        </p>
        <div class="large-action-button" onclick="endRemoveAnimal()">取消删除</div>
    </div>
    
    <div class="prompt-view work-space-border grain-utilization-prompt-view">
        <div>
            运用谷物
        </div>
        <p>
            点击火炉和灶台的烤面包行动来兑换资源
        </p>
        <div class="large-action-button" onclick="endGrainUtilization()">结束</div>
    </div>
    <div class="prompt-view work-space-border sowing-seeds-prompt-view">
        <div>
            播种
        </div>
        <p>
            点击农田格子来播种。
        </p>
        <div class="large-action-button" onclick="endSowingSeeds()">结束</div>
    </div>
    <div class="prompt-view work-space-border farming-prompt-view">
        <div>
            耕种
        </div>
        <p>
            点击农场中的格子来犁田或播种。
        </p>
        <div class="large-action-button" onclick="endFarming()">结束</div>
    </div>
    <div class="prompt-view work-space-border farm-renovation-prompt-view">
        <div> 农场改建 </div>
        <p> <!--  点击房屋翻新按钮来进行翻新</br>
            1次翻新：1芦+x泥->x砖房；1芦+x石->x石屋。</br>  -->
            点击农场中的格子来建造围栏，<br />
            同一块牧场的多个格子需要保持邻接。 </br>
            1木头=1栅栏
        </p>
        <!-- <div class="large-action-button" onclick="startHouseRenovation()">房屋翻新</div> -->
        <div class="large-action-button" onclick="startAnotherPasture()">开始围下一个牧场</div>
        <div class="undo-action" onclick="undoAddPasture()">撤回上一步</div>
        <div class="large-action-button" onclick="endFarmRenovation()">改建结束</div>
    </div>
    <div class="prompt-view work-space-border feeding-phase-view">
        <div>
            给养阶段
        </div>
        <p>
            你还需要支付 <span class="needed-food"></span> 个食物。
        </p>
        <div class="large-action-button" onclick="handleDirectPayment()">直接支付食物</div>
        <div class="large-action-button" onclick="handleAcquireDisadvantage()">获得劣势</div>
    </div>
    <div class="prompt-view work-space-border before-final-score-view">
        <div>
            终局计分准备
        </div>
        <p>
            游戏即将进行终局计分，</br>
            你还可以在此时进行一些操作，比如资源换分等。
        </p>
        <div class="large-action-button" onclick="completeBeforeFinalScore()">完成</div>
    </div>
    <div class="prompt-view work-space-border final-score-view">
        <div>
            终局计分
        </div>
        <div class="item-scores"></div> 
        <div class="large-action-button" onclick="newGame()">重新开始</div>
    </div>
    <div class="prompt-view work-space-border occupation-training-prompt-view">
        <div>
            职业训练
        </div>
        <p>
        </p>
        <div class="large-action-button" onclick="endOccupationTraining()">结束</div>
    </div>
    <div class="prompt-view work-space-border play-minor-development-view">
        <div>请打出一张次要发展卡。</div>
        <p>
        </p>
        <div class="large-action-button" onclick="endPlayMinorDevelopmentCard()">完成</div>
    </div>
    <div class="prompt-view work-space-border bake-bread-prompt-view">
        <div>
            烤面包
        </div>
        <p>
            点击火炉、灶台等卡牌上的按钮，来选择烤面包。
        </p>
        <div class="large-action-button" onclick="endBakeBread()">完成</div>
    </div>
    <div class="prompt-view work-space-border A118-prompt-view">
        <div>树木园丁</div>
        <p>收获时节，你获得了1个木材。现在你还可以用食物购买至多额外2个木材，请选择：</p>
        <div class="large-action-button" onclick="purchaseWoodForA118(0)">不购买额外木材</div>
        <div class="large-action-button" onclick="purchaseWoodForA118(1)">用1个食物购买1个木材</div>
        <div class="large-action-button" onclick="purchaseWoodForA118(2)">用2个食物购买2个木材</div>
    </div>
    

    <!-- 主要发展卡列表 -->
    <div class="major-development-card">
        <h3>主要发展卡</h3>
        <div class="common-work-space-container">
            <div class="work-space-column work-space-left-list">
                <div class="work-space-item work-space-border" id="major-development-fireplace"
                    onclick="selectMajorDevelopment('fireplace', 0)">
                    <div class="work-space-title">
                        火炉 (2泥 1分)
                    </div>
                    <p>
                        在任何时候：<br />
                        1蔬菜/猪/羊=2食<br />
                        1牛=3食<br />
                        烤面包：1麦=2食
                    </p>
                </div>
                <div class="work-space-item work-space-border" id="major-development-cooking-hearth"
                    onclick="selectMajorDevelopment('cookingHearth', 0)">
                    <div class="work-space-title">
                        灶台 (4泥 1分)
                    </div>
                    <p>
                        如果你归还火炉则无需花费
                        在任何时候：<br />
                        1蔬菜/猪=3食<br />
                        1羊=2食<br />
                        1牛=4食<br />
                        烤面包：1麦=3食
                    </p>
                </div>
                <div class="work-space-item work-space-border" id="major-development-stone-oven"
                    onclick="selectMajorDevelopment('stoneOven', 0)">
                    <div class="work-space-title">
                        石造烤炉 (3石 1泥 3分)
                    </div>
                    <p>
                        "烤面包"行动:<br />
                        1麦-2x->4食物<br />
                        当你建造这个主要发展时,可以立即执行一次"烤面包"行动。
                    </p>
                </div>
                <div class="work-space-item work-space-border" id="major-development-pottery-workshop"
                    onclick="selectMajorDevelopment('potteryWorkshop', 0)">
                    <div class="work-space-title">
                        陶器工坊 (2泥 2石 2分)
                    </div>
                    <p>
                        收成时：<br />
                        1泥 - 1x -> 2食物<br />
                        计分时：<br />
                        3/5/7泥 -> 1/2/3点
                    </p>
                </div>
                <!-- 主要发展卡 - 制篮工坊 -->
                <div class="work-space-item work-space-border" id="major-development-basketry-workshop"
                    onclick="selectMajorDevelopment('basketryWorkshop', 0)">
                    <div class="work-space-title">
                        制篮工坊 (2芦 2石 2分)
                    </div>
                    <p>
                        收成时：<br />
                        1芦 - 1x -> 3食物<br />
                        计分时：<br />
                        2/4/5芦 -> 1/2/3点
                    </p>
                </div>

                <!-- ... -->
            </div>
            <div class="work-space-column work-space-right-list">
                <div class="work-space-item work-space-border" id="major-development-fireplace1"
                    onclick="selectMajorDevelopment('fireplace', 1)">
                    <div class="work-space-title">
                        火炉 (3泥 1分)
                    </div>
                    <p>
                        在任何时候：<br />
                        1蔬菜/猪/羊=2食<br />
                        1牛=3食<br />
                        烤面包：1麦=2食
                    </p>
                </div>
                <div class="work-space-item work-space-border" id="major-development-cooking-hearth1"
                    onclick="selectMajorDevelopment('cookingHearth', 1)">
                    <div class="work-space-title">
                        灶台 (5泥 1分)
                    </div>
                    <p>
                        如果你归还火炉则无需花费
                        在任何时候：<br />
                        1蔬菜/猪=3食<br />
                        1羊=2食<br />
                        1牛=4食<br />
                        烤面包：1麦=3食
                    </p>
                </div>
                <div class="work-space-item work-space-border" id="major-development-brick-oven"
                    onclick="selectMajorDevelopment('brickOven', 0)">
                    <div class="work-space-title">
                        砖石烤炉 (3泥 1石 2分)
                    </div>
                    <p>
                        "烤面包"行动:<br />
                        1麦-1x->5食物<br />
                        当你建造这个主要发展时,可以立即执行一次"烤面包"行动。
                    </p>
                </div>
                <!-- 主要发展卡 - 木工坊 -->
                <div class="work-space-item work-space-border" id="major-development-carpentry-workshop"
                    onclick="selectMajorDevelopment('carpentryWorkshop', 0)">
                    <div class="work-space-title">
                        木工坊 (2木 2石 2分)
                    </div>
                    <p>
                        收成时：<br />
                        1木 - 1x -> 2食物<br />
                        计分时：<br />
                        3/5/7木 -> 1/2/3点
                    </p>
                </div>
                <div class="work-space-item work-space-border" id="major-development-well"
                    onclick="selectMajorDevelopment('well', 0)">
                    <div class="work-space-title">
                        井 (1木 3石 4分)
                    </div>
                    <p>
                        在接下来5轮的轮次格上各放置1个食物。在这些轮开始时，你从该格子上拿取放置的食物。
                    </p>
                </div>
                <!-- ... -->
            </div>
        </div>
        <div class="prompt-view work-space-border" style="display: block;">
            <div class="major-development-prompt-view-title">你可以打出一张 主要 或 次要 发展卡。</div>
            <div class="large-action-button" onclick="endDevelopmentCard()">返回</div>
        </div>
    </div>

    <div class="self-board">
        <div class="farm">
            <div class="farm-table">
                <div class="farm-row farm-y0">
                    <div class="farm-cell farm-x0" onclick="selectCell(0,0)"></div>
                    <div class="farm-cell farm-x1" onclick="selectCell(1,0)"></div>
                    <div class="farm-cell farm-x2" onclick="selectCell(2,0)"></div>
                    <div class="farm-cell farm-x3" onclick="selectCell(3,0)"></div>
                    <div class="farm-cell farm-x4" onclick="selectCell(4,0)"></div>
                </div>
                <div class="farm-row farm-y1">
                    <div class="farm-cell farm-x0" onclick="selectCell(0,1)">木屋</div>
                    <div class="farm-cell farm-x1" onclick="selectCell(1,1)"></div>
                    <div class="farm-cell farm-x2" onclick="selectCell(2,1)"></div>
                    <div class="farm-cell farm-x3" onclick="selectCell(3,1)"></div>
                    <div class="farm-cell farm-x4" onclick="selectCell(4,1)"></div>
                </div>
                <div class="farm-row farm-y2">
                    <div class="farm-cell farm-x0" onclick="selectCell(0,2)">木屋</div>
                    <div class="farm-cell farm-x1" onclick="selectCell(1,2)"></div>
                    <div class="farm-cell farm-x2" onclick="selectCell(2,2)"></div>
                    <div class="farm-cell farm-x3" onclick="selectCell(3,2)"></div>
                    <div class="farm-cell farm-x4" onclick="selectCell(4,2)"></div>
                </div>
            </div>
        </div>
    </div>
    <div class="control-panel">
        <button class="action-button" onclick="newGame()">新游戏</button>
        <button id="display-major-development-btn" class="action-button" onclick="selectDevelopmentCard('displayMajorDevelopmentCard')">展示主要发展卡</button>
        <button class="action-button" onclick="exchangeGrainForFood()">1小麦 兑换 1食物</button>
        <button class="action-button" onclick="exchangeVegetableForFood()">1蔬菜 兑换 1食物</button>
        <button id="move-animal-btn" class="action-button" onclick="startMoveAnimal()">移动动物或畜棚</button>
        <button id="move-single-animal-btn" class="action-button" onclick="startMoveAnimal(true)">移动1只动物或畜棚</button>
        <button id="remove-animal-btn" class="action-button" onclick="startRemoveAnimal()">删除1只动物</button>
    </div>
    <div class="minor-development-card">
    </div>
    <div class="occupation-card">
    </div>
    <div id="card-container">
    </div>

    <div style="height: 1000px;"></div>
    <div style="color: wheat;">版本号：20240621-01</div>
</body>

</html>